/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bgu.sonar.util.ui.pans;

import javax.swing.JPanel;

/**
 *
 * @author bennyl
 */
public abstract class SyncingDataView<T> extends DataViewSynchronizer<T> {

    DataView<T> dview;

    public SyncingDataView(JPanel container) {
        this.dview = new DataView<T>(container) {
            @Override
            protected void syncToModel() {
                SyncingDataView.this.syncToModel();
            }
        };
    }

    public T getModel() {
        return dview.getModel();
    }

    public void setModel(T model) {
        dview.setModel(model);
    }

    public void showError(Exception ex) {
        dview.showError(ex);
    }

    public JPanel getComponent() {
        return dview.getComponent();
    }

    public void showLoading() {
        dview.showLoading();
    }
    
    @Override
    public DataView<T> getDataView() {
        return dview;
    }

    public abstract void syncToModel();
    
}
